<%@ page contentType="text/html; charset=utf-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="thx" uri="/thx-tags" %>
<%@ taglib prefix="fun" uri="http://java.sun.com/jsp/jstl/functions"%>
	<div class="box-header with-border">
		<div class="row"></div>
	</div>
	<div class="box-body no-padding">
		<form id="appConfig-fieldAuth-form" name="ui-adminlte-form"
			data-toggle="validator" role="form" method="post" 
			action="${pageContext.request.contextPath}/workflow/fieldOption!saveActivity.action">
			<input name="appId" value="${appId }" type="hidden" />
			<table class="table table-bordered" style="margin-bottom:0px">
				<thead>
					<tr>
						<th>活动/字段</th>
						<c:forEach items="${listField}" var="field">
						<th class="formPage ${field.fieldId}">${field.fieldText}</th>
						</c:forEach>
					</tr>
				</thead>
				<tbody>
					<c:if test="${empty listActivity}">
						<tr>
							<td colspan="${fun:length(listField)+1}">暂无流程活动数据！</td>
						</tr>
					</c:if>
					<c:forEach items="${listViews}" var="views" varStatus="viewIndex">
						<tr>
							<td>
								${views.name}
								<input type="hidden" name="dataView.name" value="${views.name}"/>
							</td>
							<c:forEach items="${listField }" var="field" varStatus="fieldIndex">
						   	<td class="${field.fieldId}">
					 			<c:forEach items="${views.check}" var="check" begin="${fieldIndex.index}" end="${fieldIndex.index}" varStatus="checkIndex">
					 			  	<select name="dataView.check[${viewIndex.index }]" class="form-control">
								 		<option value="R"  <c:if test="${views.check[checkIndex.index]=='R'}">selected="selected"</c:if>>只读</option>
								 		<option value="N"  <c:if test="${views.check[checkIndex.index]=='N'}">selected="selected"</c:if>>不显示</option>
								 		<option value="W"  <c:if test="${views.check[checkIndex.index]=='W'}">selected="selected"</c:if>>可编辑</option>
								 	</select>
							   	</c:forEach>
						   	</td>
							</c:forEach>
						</tr>
					</c:forEach>
				</tbody>
				<tfoot>
					<tr>
						<td colspan="${fun:length(listField)+1}">
							 <!--分页区-->
							<div class="pagePanel" style="margin-top:0px;"></div>
						</td>
					</tr>
				</tfoot>
			</table>
		    <div class="modal-footer">
				<button type="submit" class="btn btn-primary">保存</button>
			</div>
		</form>
	</div>
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/horizontalPage4table.js"/>
<script src="${pageContext.request.contextPath}/workflow/js/app-form.js" ></script>
<script>
 $(function(){
	 //分页组件初始化
	 //$("#appConfig-fieldAuth-form table").pluginTablePage($("#appConfig-fieldAuth-form .formPage").length,5,".pagePanel");
	 appform.init("#appConfig-fieldAuth-form");
	 
	 $.ajax({
			url : ctxPath+"/workflow/appConfig!getTabAuth.action",
			data : "appId="+'${appId}',
			type : 'post',
			success : function(msg) {
				msg = util.strToObj(msg);
				if(msg[0]=="1"){//字段管理
					$('a[href="#field-manage"]').parent("li").show();
				}else{
					$('a[href="#field-manage"]').parent("li").hide();
				}
				if(msg[1]=="1"){//表单模板
					$('a[href="#form-template"]').parent("li").show();
				}else{
					$('a[href="#form-template"]').parent("li").hide();
				}
				if(msg[2]=="1"){//字段读写性设置
					$('a[href="#field-auth"]').parent("li").show();
				}else{
					$('a[href="#field-auth"]').parent("li").hide();
				}
				if(msg[3]=="1"){//流程操作权限
					$('a[href="#flow-operate"]').parent("li").show();
				}else{
					$('a[href="#flow-operate"]').parent("li").hide();
				}
			},
			error : function() {
			}
	 	});
 })
</script>